#ifndef _H_DEBUG
#define _H_DEBUG

#ifdef DEBUG
#define _DPRINT(arg) {Serial.print(millis());Serial.print(" DBG [");Serial.print(__func__); Serial.print(":");Serial.print(__LINE__);Serial.print("] ");Serial.println(arg);}

#define _DPRINT2(arg,mod) {Serial.print(millis());Serial.print(" DBG [");Serial.print(__func__); Serial.print(":");Serial.print(__LINE__);Serial.print("] ");Serial.println((arg),mod);}

#define _DPRINT3(msg,arg,mod) {Serial.print(millis());Serial.print(" DBG [");Serial.print(__func__); Serial.print(":");Serial.print(__LINE__);Serial.print("] ");Serial.print(msg);Serial.print(":"); Serial.println((arg),mod);}

#define _DPRINT_HDR() {Serial.print(millis());Serial.print(" DBG [");Serial.print(__func__); Serial.print(":");Serial.print(__LINE__);Serial.print("] ");Serial.print(cmdSent,HEX);Serial.print(":"); Serial.print(cmdRcvd,HEX);Serial.print(":"); Serial.print(methodId,HEX);Serial.print(":"); Serial.print(numArgBytes,HEX);Serial.print(":"); Serial.println(argCRC,HEX);}

#define _DPRINT_PEER_HDR() {Serial.print(millis());Serial.print(" DBG [");Serial.print(__func__); Serial.print(":");Serial.print(__LINE__);Serial.print("] ");Serial.print(cmdRcvd,HEX);Serial.print(":"); Serial.print(peerCmdRcvd,HEX);Serial.print(":"); Serial.print(peerMethodId,HEX);Serial.print(":"); Serial.print(peerDataBytes,HEX);Serial.print(":"); Serial.println(peerCRC,HEX);}

#define _DPRINT4(msg,n1,n2,mod) {Serial.print(millis());Serial.print(" DBG [");Serial.print(__func__); Serial.print(":");Serial.print(__LINE__);Serial.print("] ");Serial.print(msg);Serial.print(":"); Serial.print(n1,mod);Serial.print(":"); Serial.println(n2,mod);}


#else

#define _DPRINT(arg) 0
#define _DPRINT2(arg,mod) 0
#define _DPRINT3(msg,arg,mod) 0
#define _DPRINT_HDR() 0
#define _DPRINT_PEER_HDR() 0
#define _DPRINT4(msg,n1,n2,mod) 0
#endif

// Turn TRACE on by setting it in source module.
#ifdef TRACE
#define _DTR() {Serial.print("+");Serial.print(__func__);Serial.print(":");Serial.println(__LINE__);}
#define _RETURN() {Serial.print("-");Serial.print(__func__);Serial.print(":");Serial.println(__LINE__);return;}
#define _RETURN(arg) {{Serial.print("-");Serial.println(__func__);return(arg);}
#else
#define _DTR() 0
#define _RETURN() return
#define _RETURN(arg) return(arg)
#endif




#endif
